workspacesView/workspacesDisplay: Don't sync geometry when animating
Synchronizing the actual geometry while animating from / to the overview can
break the animation. Let's prevent that. This code will go away soon anyway,
but to not lose bisectability, it's better not to leave it misbehaving until
then.
workspacesView: Center active workspace in allocation
When vertically snapping, WorkspacesView currently allocates workspaces
side-by-side, then applies an extra step of translation to center to
the active workspace. This extra step, however, gets in our way because
now we need tighter control of the workspaces positions in allocation,
in order to properly interpolate them.
Move the translation of workspaces to the allocation code itself, and
remove the extra translation step.
viewSelector: Tie workspace fit mode to adjustment
Tie the fit mode adjustment of WorkspacesDisplay to the
state adjustment of AppPagesContainer, and transition to
the ALL fit mode when the app grid is visible.
Currently, WorkspacesView positions each workspace on a
per-page layout, each page with the allocated width and
height of WorkspaceView. This layout doesn't work well
with horizontal workspaces.
Layout workspaces side by side, instead of per page. The
layout is influenced by a "fit mode", which reflects the
different behaviors exposed in the mockup. This fit mode
represents whether a single or all workspaces will fit
available geometry.
The single fit mode is always used for now. Next commits
will make it switch to the all fit mode when in the app
grid state.
The translation_{x,y} also needed to reflect the switch to
a side-by-side layout, and use the geometry of the workspaces
to determine the offset. Notice that, when the fit mode is ALL,
there's no translation applied.
Florian Müllner [Sat, 30 Jan 2021 01:03:07 +0000 (02:03 +0100)]
cleanup: Define GObject accessors in camelCase
gjs is smart enough to match a propertyName getter/setter to the
corresponding property-name GObject property, so use that and get
rid of the eslint camelcase rule exceptions.
Florian Müllner [Sat, 30 Jan 2021 00:03:04 +0000 (01:03 +0100)]
js: Use gjs-defined GObject accessors where possible
Nowadays gjs allows to omit get/set accessors for read-write properties,
and will define reasonable defaults in that case. In many cases we don't
need anything more than the default handling, let gjs handle those props.
The app grid itself now is horizontal, and is displayed beneath
workspaces, above the dash. This makes the indicator animations
out of place, as they're not coming from the edge anymore.
Use PageIndicators for both FolderView and AppDisplay.
workspace: Handle window-added and removed signal after window tracker
The new window preview overlay requires getting the app icon for a
window from the window tracker when it gets initialized. The window
tracker listens for the same 'window-added' signal on the MetaWorkspace
that the gnome-shell Workspace listens for to add the window preview.
The window tracker however reconnects all its signal handlers whenever
the number of workspaces changes, which means that its signal handlers
get called after the ones in Workspace ones. So by the time the
'window-added' handler in Workspace is called, the window tracker does
not have an app associated with the window.
To fix this ensure that all window related signal handlers in Workspace
are run after the ones in the window tracker.
Currently, there's one animation for the whole canvas. While it looks fine
with just one screen, it causes windows to move between screens when
switching workspaces. Instead, have a separate animation on each screen,
and sync their progress so that at any given time the progress "fraction"
is the same between all screens. Clip all animations to their screens so
that the windows don't leak to other screens.
If a window is placed between every screen, can end up in multiple
animations, in that case each part is still animated separately.
workspaceAnimation: Group sticky windows and moving window
Since the transitions consists of window clones now, all the clones appear
above sticky windows. Clone sticky windows as well, and treat them same as
moving window instead.
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Instead of reparenting windows, clone them. This will allow to properly
support multi-monitor setups in subsequent commits.
Block window mapping animation while the animation is running to prevent
new windows appearing during the animation from being visible at the same
time as their clones.
In future we will need to use window clones to better support multiple
monitors. To avoid having to hide every window, show wallpapers behind
the workspace transition: one per monitor.
Put the wallpaper into a separate class right away, later it will be
useful to make the animation per-monitor.
Florian Müllner [Fri, 8 Jan 2021 11:11:06 +0000 (12:11 +0100)]
windowPreview: Overhaul chrome style
- increase close button size
- use custom close icon that's better suited
for the non-default 24pxp size
- use translucent light gray for both close button
and window caption
Florian Müllner [Fri, 8 Jan 2021 12:27:10 +0000 (13:27 +0100)]
windowPreviews: Replace border with scale effect
We currently use a thick border to indicate the hovered/focused preview. It
works well for that purpose, but is a bit in the face. Slightly scaling up
the preview still provides a clear indication, but in a more subtle and
elegant way.
Florian Müllner [Sat, 30 Jan 2021 04:42:47 +0000 (05:42 +0100)]
workspace: Add some padding around window previews
Commit 059ea64 removed the workspace padding after moving the
background into the workspace. However some whitespace around
window previews is still a good idea, and will be necessary
soon as we are about to indicate focus by slightly scaling up
the active preview, and don't want previews to be clipped by
the workspace in that case.
Florian Müllner [Thu, 22 Oct 2020 22:49:03 +0000 (00:49 +0200)]
workspace: Adjust spacing
Icons are always visible, so in order to not have overlays overlap
with other previews, we need to consider the sum of top- and border
oversizes rather than the maximum.
Florian Müllner [Mon, 12 Oct 2020 11:19:07 +0000 (13:19 +0200)]
windowPreview: Allow titles to overlap other previews
We are about to add additional chrome, but still want to use
as much space as possible for the previews. Allowing titles
to overlap other previews should help keeping the additional
whitespace requirement low.
Florian Müllner [Fri, 8 Jan 2021 17:36:55 +0000 (18:36 +0100)]
windowPreview: Track overlay state separately
We currently express the state as a combination of border visibility
and the eventual transition state. That's tedious, in particular if
we want to use the state outside the show()/hide() methods.
Just track the requested visibility in a separate property.
Florian Müllner [Mon, 1 Feb 2021 15:28:49 +0000 (16:28 +0100)]
workspaceThumbnails: Center thumbnails in workspace navigator
We always request a natural width based on the maximum thumbnail scale,
but may very well use a smaller scale when allocating. This currently
results in thumbnails being off center, fix this by distributing any
extra space evenly before allocating thumbnails.
Jonas Dreßler [Mon, 1 Feb 2021 10:51:27 +0000 (11:51 +0100)]
windowPreview: Cache the boundingBox of the layout manager
Accessing GObject properties from JS has proven to be quite slow because
of the JS->C->JS roundtrip involved. With the WindowPreview this
actually has an impact since we're accessing those properties very often
while creating new layouts.
So cache the boundingBox and the windowCenter properties of the
WindowPreview using a this._cachedBoundingBox JS object. This might
speed up opening the overview with lots of open windows significantly.
Jonas Dreßler [Mon, 1 Feb 2021 10:40:50 +0000 (11:40 +0100)]
workspace: Don't store strategy on layout object
We're making the layout object fully owned by the layout strategy, so
store the current strategy somewhere else, that is as a private property
of the class.
Jonas Dreßler [Mon, 1 Feb 2021 10:07:33 +0000 (11:07 +0100)]
workspace: Make computeLayout() return a layout object
Start cleaning up the whole mess around the layout object a bit and
return a new object in the LayoutStrategies computeLayout()
implementation. This object is supposed to be opaque to the API user and
will only be passed to the layout strategy.
For now, keep setting a few things on that object from outside, we'll
clean that up later.
Jonas Dreßler [Mon, 1 Feb 2021 09:39:41 +0000 (10:39 +0100)]
workspace: Move more things to LayoutStrategy subclass
Only keep computeLayout, computeWindowSlots, computeScaleAndSpace and
the contructor in the superclass, the rest is actually layout specific
and won't apply anymore when we introduce the new vertical layout
strategy.
Move the background to the Workspace class by introducing a new container
called WorkspaceBackground, which handles clipping the background to the
workarea.
Move the click action from WorkspaceDisplay into each workspace.
Florian Müllner [Fri, 29 Jan 2021 15:25:28 +0000 (16:25 +0100)]
workspaceThumbnails: Expand workspaces before scale-in animation
When the original animation was implemented, workspaces would only
ever be added at the end. We therefore got away with not having a
separate EXPANDING stage corresponding to the existing COLLAPSING
one when animating out.
Since support for creating in-between workspaces via DND was added,
this is no longer the case. And now that the thumbnails are centered,
the jump is quite noticeable.
Address this by adding new transitional states, so that we can
expand new thumbnails before scaling them in.
Florian Müllner [Fri, 29 Jan 2021 14:38:08 +0000 (15:38 +0100)]
overviewControls: Remove intermediate box
Now that the workspace switcher moved into the view selector, the
box only holds a single child. Cut out the middle man and add that
directly to the parent.
Make the slide property control the workspace scale, so that new workspaces
scale up, and destroyed workspaces scale down. The scale is done horizontally,
and only slightly vertically, as per design direction.
Rework the state tracking mechanism to remove the COLLAPSING state, since there's
no split between sliding out and collapsing anymore. Also remove the corresponding
'collapse-fraction' property from WorkspaceThumbnail.
Make ThumbnailsBox.vfunc_get_preferred_width() consider the slide-position property.
workspaceThumbnail: Use current number of workspaces for sizes
There are situations where MetaWorkspaceManager and ThumbnailsBox disagree
on the number of workspaces, for example when animating them out. It's more
important to follow the visible number of workspaces while they're updated.
Make vfunc_get_preferred_width() and vfunc_get_preferred_height() use the
current number of workspace thumbnails to calculate their sizes, instead of
MetaWorkspaceManager's n-thumbnails property.
workspaceThumbnail: Allocate final thumbnail sizes
ThumbnailsBox currently allocates each workspace thumbnail using their
porthole size, and scales them down using scale-x and scale-y. This is
slightly problematic since it doesn't allow for properly styling these
thumbnails through CSS.
Rework ThumbnailsBox to allocate workspace thumbnails at their actual
sizes, and scale down the '_contents' actor inside WorkspaceThumbnail.
Allocate workspace thumbnails horizontally. This requires introducing code
to handle the RTL direction. Do a small rewrite of the DnD hover method to
be simultaneously simpler and easier to follow, and work correctly on RTL.
overviewControls: Move workspaces thumbnails to ViewSelector
This is now all centralized in the apps page, so move the workspaces
thumbnails to ViewSelector's apps page. This allows us to remove
all the slider controls too, since they're now unused.
The transition between showing the workspaces, and the app grid, is
based on the most recent mockups: scale and move it down, and fade it
out.
Now that there's only a ACTIVITIES and a SEARCH page, the old method of handling
keyboard tabbing (extra parameters to ViewSelector._addPage()) limits what we can
do.
Manually set up the Ctrl+Alt+Tab support for each element.
Add them both in a StBoxLayout subclass with a vertical layout. This
new ActivitiesContainer class already contains an adjustment controlling
the transition between workspaces and app grid states, and althought it
is internal to it, it'll be easy to integrate with gestures in the
future.
Notice that AppDisplay is added before WorkspacesDisplay. That's because
we want the paint order to paint WorkspacesDisplay on top of AppDisplay.
Switch the ViewsPage enum to call this page ACTIVITIES, and adjust the
only caller in OverviewControls to it. At last, rename '_appsPage' to
'_activitiesPage' to also reflect the name change.
The usefulness of organizing this code in pages is lost here, but this
is a transitional state, and pages will be removed in future changes.
workspacesView: Add API to hide workspaces without destroying
This will be used by the next commit to hide workspaces when ViewSelector
switches to the search page, without destroying the workspaces so their
state is preserved.
Florian Müllner [Thu, 28 Jan 2021 22:24:44 +0000 (23:24 +0100)]
dash: Add separator between favorite and running apps
Only the area used by favorite apps can be used as drop targets, it
is not possible to add new favorites between the running apps at the
end. While that behavior makes sense, it is currently impossible to
distinguish the two areas with confusing results.
Address this by adding a visual separator between favorites and
running apps.
Florian Müllner [Mon, 25 Jan 2021 11:32:26 +0000 (12:32 +0100)]
screenshot: Return error if stream creation failed
When we fail for some reason to open a stream to write the screenshot
to, we currently return `false` to the sender. That's not wrong, but
doesn't provide any hints on what caused the failure, so return the
underlying error instead.
Florian Müllner [Mon, 25 Jan 2021 11:38:51 +0000 (12:38 +0100)]
screenshot: Use separate error when disk writes are locked down
The most likely reason for rejecting a screenshot request is that
there's an ongoing operation from the same sender. Still, we shouldn't
assume that that is the case and return an appropriate error when
writing to disk is disabled via lockdown settings.
Razze [Thu, 28 Jan 2021 19:26:54 +0000 (20:26 +0100)]
loginDialog: Keep hint string from pushing the login box higher
When we display the hint string for e.g. (or swipe finger), the login
box gets pushed up. This is leftover from older styling and should be
removed. The padding-top is unnecessary and can also be removed, so just
remove the whole line styling login-dialog-message-hint from the
stylesheet.
On X11, the scroll handler can receive smooth events, which should
trigger a workspace switch. Handle smooth events by checking their
scroll delta, and adjusting the direction depending on these deltas.
Sebastian Keller [Wed, 27 Jan 2021 22:27:31 +0000 (23:27 +0100)]
screenshot: Still remove select/pick actor if grab promise was rejected
If the grab promise is rejected due to for example on X another app
already having the grab, an error is thrown and the code that would
revert the cursor and hide the actor is not run. This actor then
prevents all mouse interactions with the shell and the windows beneath
it.
Florian Müllner [Fri, 8 Jan 2021 01:14:42 +0000 (02:14 +0100)]
workspacesView: Fix off-by-one error
The scroll adjustment's upper value corresponds to the number of
workspaces, not to the last workspace index. We want the latter
when mirroring the layout in RTL locales, so subtract 1.
Florian Müllner [Tue, 26 Jan 2021 16:12:04 +0000 (17:12 +0100)]
extensionSystem: Fix opening Extensions app from notification
Launching the app is implemented by the source's open() method, but
only external notifications are hooked up to call into the source
when no default action was provided.
Doan Nam Long Vu [Sun, 24 Jan 2021 20:39:43 +0000 (21:39 +0100)]
panel: Remove drop down arrows from standalone indicators
The keyboard/language selector area is the smallest element
on the panel. Additional margin about 6px inside the a11y
and language items to make them comfortable to click targets.
appDisplay/appFolderDialog: Don't constrain to workarea
With the transparent top bar in the overview, constraining to the
primary monitor's workarea causes the (now visible) area beneath
the top bar to not have the darker background, which causes a visual
discontinuity in the layout.
Sebastian Keller [Wed, 20 Jan 2021 01:03:49 +0000 (02:03 +0100)]
appDisplay: Fix app folder icon subicon spacing
The code previously was using CSS to define row/column spacing and
padding which was combined with a subicon size computed in code relative
to the requested icon size.
In smaller icon sizes it was possible for the CSS spacing+padding + the
size of the two subicons to exceed the requested icon size. This then
would lead to the label being pushed down for app folders compared to
other icons.
Another more severe issue caused by this would happen if the first item
in an icon grid was an app folder. Then the calculation for the maximum
allowed icon size could be off, leading to all icons in the grid
becoming smaller than actually necessary.
This commit changes this to use homogeneous row and column layouts to
evenly distribute the remaining spacing instead of using a fixed CSS
value.
Florian Müllner [Wed, 20 Jan 2021 00:44:21 +0000 (01:44 +0100)]
appDisplay: Do not duplicate app favorites
With the new position, the dash is now stronger connected to the
app grid than it used to; reflect that by showing apps either
in the grid or the dash, not both (except for non-favorite
running apps).
Sebastian Keller [Wed, 13 Jan 2021 22:24:49 +0000 (23:24 +0100)]
workspacesView: Disable swipe tracker when animating from overview
It was possible to switch workspaces by quickly dragging the workspace
immediately after clicking on a window during the transition from the
overview. This is unlikely something that is intentionally used but can
be confusing and look bad when triggered accidentally.
Sebastian Keller [Tue, 19 Jan 2021 20:12:49 +0000 (21:12 +0100)]
automountManager: Remove unused volume queue
This is some leftover from code that was used to keep track of volumes
added/removed while the screen was locked before the move to a
components system in 2a800e4c. All that the remaining code does is
filter devices from an empty list.
Florian Müllner [Mon, 18 Jan 2021 23:57:30 +0000 (00:57 +0100)]
overviewControls: Simplify dash placement
Now that the dash is always visible, it doesn't make sense to keep
it in a separate layer from the main overview group and use a
separate spacer actor as a placeholder.